package rs.ac.uns.ftn.informatika.mbs2.e11031.etaksi.servlet;

import java.io.IOException;
import java.util.Collection;

import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import rs.ac.uns.ftn.informatika.mbs2.e11031.etaksi.dao.VoznjaDao;
import rs.ac.uns.ftn.informatika.mbs2.e11031.etaksi.entitet.Voznja;

@SuppressWarnings("serial")
public class PrikazVoznjiKontroler extends HttpServlet {

	@EJB
	private VoznjaDao cVoznjaDao;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {

		Collection<Voznja> voznje = cVoznjaDao.pronadjiSve();
		req.getSession().setAttribute("voznje", voznje);
		getServletContext().getRequestDispatcher("/jsp/prikazVoznji.jsp")
				.forward(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doGet(req, resp);
	}

}
